/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GachNo;
 
import java.util.Vector;
import javax.microedition.lcdui.ChoiceGroup;

/**
 *
 * @author ThanhTrung
 */
public class ListFilter extends ChoiceGroup { 

	private Vector data;

	public ListFilter(String title, int listType, Vector data) {
            super(title, listType);
            this.data = data;
	}

	public Vector filter(String str) {
            this.deleteAll();
            Vector tempData = new Vector();
            String temp;
            int length = this.data.size();

            for (int j = 0; j < length; j++) {
                temp = (String) this.data.elementAt(j);

                if (temp.startsWith(str)) {
                    tempData.addElement(temp);
                    this.append(temp, null);
                }
            }
            return tempData;
	}

}
